import cv2
import os


video_folder_path = "D:\\桌面文件\\前后端项目\\newbot\\python_demo\\circular_lcd\\emoji\\1"


video_files = [f for f in os.listdir(video_folder_path) if f.endswith(".mp4")]

while True:
    for video_file in video_files:
        video_path = os.path.join(video_folder_path, video_file)

        cap = cv2.VideoCapture(video_path)

        if not cap.isOpened():
            print(f"Error file: {video_path}")
            continue

        width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
        height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
        fps = cap.get(cv2.CAP_PROP_FPS)

        print(f"视频: {video_path} (Width: {width}, Height: {height}, FPS: {fps})")

        while True:
            ret, frame = cap.read()

            if not ret:
                break

            cv2.imshow("Video Player", frame)

            if cv2.waitKey(25) & 0xFF == ord("q"):
                break

        cap.release()

    cv2.destroyAllWindows()
